import numpy as np
import pandas as pd
import plotly.express as px

# 生成 x 和 y 的值
x = np.linspace(0, 2 * np.pi, 100)
y = np.linspace(0, 2 * np.pi, 100)
X, Y = np.meshgrid(x, y)
# 计算 z = sin(x + y)
Z = np.sin(X + Y)

# 将数据转换为 DataFrame
df = pd.DataFrame({
    "x": X.flatten(),
    "y": Y.flatten(),
    "z": Z.flatten()
})

fig = px.scatter_3d(
    df,
    x="x",
    y="y",
    z="z",
    color="z"
)

fig.show()
